package com.newtouch.avmarketing.mgr.modules.avmarkrting.service.impl;

import com.newtouch.avmarketing.mgr.modules.avmarkrting.service.SoundService;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
import org.springframework.stereotype.Service;
import java.io.*;

@Service
public class SoundServiceImpl implements SoundService {
    @Override
    public void playSound(File file) throws FileNotFoundException, JavaLayerException, InterruptedException {
        //建立文件输入流  注意文件的路径
        FileInputStream fis=new FileInputStream(file);
        Player player=new Player(fis);
        //播放音频
        player.play();
    }
}
